package be.fedict.drupaltest.parts.installation;

import be.fedict.drupaltest.parts.BasePage;
import java.util.List;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

/**
 * Drupal installation wizard profile page.
 * 
 * @author Bart Hanssens
 */
public class ChooseProfilePage extends BasePage {
    @FindBy(id = "install-select-profile-form")
    private WebElement form;
    @FindBy(name = "profile")
    private List<WebElement> profiles;

    
    /**
     * Get a specific radio button (profile) element
     * 
     * @param profile
     * @return element or null 
     */
    public WebElement getProfileElement(String profile) {
        return getRadioElement(profiles, profile);
    }
    
    /**
     * Select the Drupal profile
     * 
     * @param profile 
     */
    public void selectProfile(String profile) {
        WebElement el = getProfileElement(profile);
        el.click();
    }
    
    /**
     * Submit form
     */
    public void submit() {
        form.submit();
    }
}
